StartSimulationEngine  "SimState/BasicObstacles.xml"


AddDifferentialDriveEntity    base1
	/Position:-1  0  0

AddSonarEntity    sonar1
	/Position:0  0.4  -0.3
	/ParentEntity:base1


AddDifferentialDriveEntity    base2
	/Position:0  0  0

AddSonarEntity    sonar2
	/Position:0  0.4  -0.3
	/ParentEntity:base2

AddDifferentialDriveEntity    base3
	/Position:1  0  0

AddSonarEntity    sonar3
	/Position:0  0.4  -0.3
	/ParentEntity:base3

FlushScript  


Procedure  Go(left, right) 
		
	base1.Go(left, right)
	base2.Go(left, right)
	base3.Go(left, right)
		
End


Procedure  GoFor(left, right, duration) 
	
	call GoFor1(left, right, duration) with concur
	call GoFor2(left, right, duration) with concur
	call GoFor3(left, right, duration) with concur
	
	wait duration
	
	return 1
End

Procedure  GoTo(distance, power, duration) 
	
	call GoTo1(distance, power) with concur
	call GoTo2(distance, power) with concur
	call GoTo3(distance, power) with concur
	
	wait duration
	
	return 2
End

Procedure  Turn(degrees, power, duration) 
	
	call Turn1(degrees, power) with concur
	call Turn2(degrees, power) with concur
	call Turn3(degrees, power) with concur
	
	wait duration
	
	return 3
End



Procedure  GoFor1(left, right, duration) 
	base1.GoFor(left, right, duration)
End

Procedure  GoFor2(left, right, duration) 
	base2.GoFor(left, right, duration)
End

Procedure  GoFor3(left, right, duration) 
	base3.GoFor(left, right, duration)
End

Procedure  GoTo1(distance, power) 
	base1.GoTo(distance, power)
End

Procedure  GoTo2(distance, power) 
	base2.GoTo(distance, power)
End

Procedure  GoTo3(distance, power) 
	base3.GoTo(distance, power)
End

Procedure  Turn1(degrees, power) 
	base1.Turn(degrees, power)
End

Procedure  Turn2(degrees, power) 
	base2.Turn(degrees, power)
End

Procedure  Turn3(degrees, power) 
	base3.Turn(degrees, power)
End


